home *** CD-ROM | disk | FTP | other *** search
-
- function units_mortar_setup()
- units_setup(4,false,ENET_EFFECT_PS_SETUPSMOKE_SMALL,ENET_EFFECT_GEOMETRY_MORTARSHADOW)
- -- uniGetExecutor():addSimpleEffect(ENET_EFFECT_EXPERIMENTAL_SHIELD)
- -- uniGetExecutor():addSimpleEffect(862)
- end
-
- function units_mortar_resetup()
- units_setup(4,false,nul,ENET_EFFECT_GEOMETRY_MORTARSHADOW)
- end
-
- function units_mortar_select()
- units_select(22,2)
- end
-
- function units_mortar_unselect()
- units_unselect()
- end
-
- function units_mortar_selectenemy()
- uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
- end
-
- function units_mortar_damaged()
- uniGetExecutor():applyDamage(uniGetLife())
- end
-
- function units_mortar_highlight()
- uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
- end
-
- function units_mortar_explode()
- units_explode_small3()
- end
-
- function units_mortar_move()
- local unit = uniGetExecutor()
- local sound = unit:play3DSound("mortar_move.wav",1)
- local steps = {}
- local i = 0;
- for i = 0,1 do
- steps[i] = unit:getBone(ENBT_STEPEMITTER,i):addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_LIGHTTANKSTEPSEMITTER)
- steps[i+2] = unit:getBone(ENBT_STEPEMITTER,i):addSimpleEffect(ENET_EFFECT_PS_NEWTRACKSMOKE3)
- end
- units_rotateWheels()
- waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 1.0))
- waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,100))
- sound:destroy()
- unit:play3DSound("mortar_stop.wav",0):destroy()
- for i = 0,1 do
- if(unit:getScale() < 1.0) then
- steps[i]:destroy()
- else
- steps[i]:setTransformOwner()
- steps[i]:suspendedDestroy(70)
- end
- steps[i+2]:suspendedDestroy(1.0)
- end
- units_stopWheels()
- end
-
- function units_mortar_fire()
- local unit = uniGetExecutor()
- local gt = unit:getBone(ENBT_GUNTOWER)
- gt:play3DSound("mortar_guntower_rotate.wav",0)
-
- local firespot = gt:getBone(ENBT_FIRE1)
- local gun = gt:getBone(ENBT_GUN)
-
- local rot = gun:addRotationEffect(ENET_EFFECT_ROTATE_WHEEL,-MATH_PI / 1.5)
- pause(0.25)
- rot:destroy()
-
- waitDeath(gt:parabolicTargetting(uniGetTarget(),unit:getBone(ENBT_FIRE1)))
-
- gt:play3DSound("mortar_cannon_fire.wav",0):destroy()
- local shot = firespot:addSimpleEffect(ENET_EFFECT_PS_NEWPLAZMABALL_FLY2)
- firespot:addSimpleEffect(ENET_EFFECT_PS_DINOROBOTSHOT):suspendedDestroy(0.5)
-
- shot:executeCommand(ENC_FIRE1)
- gt:gunRecoil(0,0.2,10)
- pause(1.0)
- gt:play3DSound("mortar_guntower_rotate.wav",0)
- gun:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERDEFAULT,MATH_PI / 3.0)
- gt:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERDEFAULT,MATH_PI)
- unit:addFireArrow()
- end
-
- registerCommand(ENSCRIPTSET_MORTAR,ENC_MOVE,"units_mortar_move")
- registerCommand(ENSCRIPTSET_MORTAR,ENC_FIRE1,"units_mortar_fire")
- registerCommand(ENSCRIPTSET_MORTAR,ENC_FIRE2,"units_mortar_fire")
- registerCommand(ENSCRIPTSET_MORTAR,ENC_SELECT,"units_mortar_select")
- registerCommand(ENSCRIPTSET_MORTAR,ENC_SELECTENEMY,"units_mortar_selectenemy")
- registerCommand(ENSCRIPTSET_MORTAR,ENC_UNSELECT,"units_mortar_unselect")
- registerCommand(ENSCRIPTSET_MORTAR,ENC_SETUP,"units_mortar_setup")
- registerCommand(ENSCRIPTSET_MORTAR,ENC_RESETUP,"units_mortar_resetup")
- registerCommand(ENSCRIPTSET_MORTAR,ENC_DAMAGED,"units_mortar_damaged")
- registerCommand(ENSCRIPTSET_MORTAR,ENC_EXPLODE,"units_mortar_explode")
- registerCommand(ENSCRIPTSET_MORTAR,ENC_HIGHLIGHT,"units_mortar_highlight")
- registerCommand(ENSCRIPTSET_MORTAR,ENC_INSIDE,"units_inside")
-
- -- make description of unit
- desc = getEffectDescriptionP(ENET_UNIT_MORTAR)
- desc.ClassID = ENCLASS_MESHINSTANCE
- desc.EffectClassType = ENECT_GEOMETRY
- desc.FileName = "mortar.rmd"
- desc.ScriptSet = ENSCRIPTSET_MORTAR
- desc.MoveType = ENMOVE_GROUNDORIENTED
- desc.RenderType = ENRENDERTYPE_GEOMETRY
- desc.Material = ENMAT_RIGIDSKINNEDMESH
- desc.MaterialColors = units_materialcolors_human
-
- -- shadow
- desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_MORTARSHADOW)
- desc.ClassID = ENCLASS_MESHINSTANCE
- desc.EffectClassType = ENECT_GEOMETRY
- desc.FileName = "mortar_shadow.rmd"
- desc.RenderType = ENRENDERTYPE_SHADOW
- desc.Material = ENMAT_SHADOW
- desc.MaterialColors = units_materialcolors_shadow
-
- -- register new unit to logic
- unitDesc = logic_getUnitDescP(4)
- unitDesc.group = 0
- unitDesc.order = 2
- unitDesc.unit_res_id = ENET_UNIT_MORTAR
- --unitDesc.unit_res_id = ENET_UNIT_LIGHTTANK_ALIEN
- unitDesc.unit_icon_id = "Mortar_h_small_normal.dds"
- unitDesc.active_id = "Mortar_h_small_active.dds"
- unitDesc.pressed_id = "Mortar_h_small_pressed.dds"
- unitDesc.big_icon_id = "Mortar_h_big_normal.dds"
- unitDesc.small_icon_id = "Mortar_u_stats.dds"
- unitDesc.HP = 4
- unitDesc.MP = 10
- unitDesc.WR = 2
- unitDesc.min_WR = 1
- unitDesc.WD = 2
- unitDesc.WR2 = 0
- unitDesc.min_WR2 = 0
- unitDesc.WD2 = 0
- unitDesc.ability = 0
- unitDesc.transport = 0
- unitDesc.value = 2
- unitDesc.race = 0
- unitDesc.fire_pause = 1.0
- unitDesc.move_pause = 0.7
- unitDesc.unit_info_scale = 0.06
- unitDesc.scn_name = "MORTAR"
-
- ------------------------------------------------------------------------------------------------------
- ------------------------ effects related to unit------------------------------------------------------
- ------------------------------------------------------------------------------------------------------
-
- function bullets_plazmaball_fire()
- local bullet = uniGetExecutor()
- bullet:setTransformOwner()
- local light = bullet:addSimpleEffect(ENET_EFFECT_LIGHT_PLAZMABALLFLY)
- local sound = bullet:play3DSound("mortar_plazmaball_fly.wav",1)
- local track = bullet:addSimpleEffect(ENET_EFFECT_PS_PLAZMABALLFLY)
- -- waitDeath(bullet:addMoveEffect(ENET_EFFECT_MOVE_GRAVITYPARABOLA,150,uniGetTarget()))
- waitDeath(bullet:parabolicFly(uniGetTarget()))
- sound:destroy()
- light:destroy()
- track:suspendedDestroy(1.0)
- bullet:play3DSound("mortar_plazmaball_explode.wav",0):destroy()
- bullet:addSimpleEffect(ENET_EFFECT_LIGHT_PLAZMABALLEXPLODE):delayedDestroy(1.0)
- bullet:addSimpleEffect(ENET_EFFECT_PS_PLAZMABALLEXPLODE):suspendedDestroy(1.0)
- uniGetTarget():executeCommand(ENC_DAMAGED)
- pause(1.0)
- bullet:destroy()
- end
-
- registerCommand(ENSCRIPTSET_BULLET_PLAZMABALL,ENC_FIRE1,"bullets_plazmaball_fire")
-